home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / security / xinetd / xlog.1.0.9 / filelog.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-07  |  1.2 KB  |  41 lines

  1. /*
  2.  * (c) Copyright 1992 by Panagiotis Tsirigotis
  3.  * All rights reserved.  The file named COPYRIGHT specifies the terms 
  4.  * and conditions for redistribution.
  5.  */
  6.  
  7.  
  8. /*
  9.  * $Id: filelog.h,v 1.1 1992/10/10 07:01:40 panos Exp $
  10.  */
  11.  
  12. /*
  13.  * The file can be either open or closed.
  14.  * When the file is closed, the state is always FL_CLOSED.
  15.  * When the file is open, the state is:
  16.  *        FL_OPEN:            if everything is ok
  17.  *        FL_SIZE:            if the hard limit was exceeded
  18.  *        FL_ERROR:        if an error occured
  19.  */
  20. typedef enum { FL_CLOSED = 0, FL_OPEN, FL_SIZE, FL_ERROR } filelog_state_e ;
  21.  
  22. struct filelog
  23. {
  24.     int fd ;
  25.     filelog_state_e state ;
  26.     int close_on_exec ;
  27.     int error ;                            /* error code when state is FL_ERROR         */
  28.     int size_control ;                /* TRUE or FALSE                                     */
  29.     int issued_warning ;                /* when the soft limit was exceeded         */
  30.     unsigned size ;               /* current size                             */
  31.     unsigned soft_limit ;
  32.     unsigned hard_limit ;
  33. } ;
  34.  
  35. #define FILELOG_ENABLE_SIZE_CONTROL( flp )        (flp)->size_control = TRUE
  36. #define FILELOG_DISABLE_SIZE_CONTROL( flp )        (flp)->size_control = FALSE
  37. #define FILELOG_SIZE_CONTROL( flp )                ( (flp)->size_control )
  38.  
  39. #define FILELOG( xp )            ((struct filelog *)xp->data)
  40.  
  41.